//
//  BNavViewController.m
//  NYP
//
//  Created by jarze on 2018/6/5.
//  Copyright © 2018年 niuyan.com. All rights reserved.
//

#import "BNavViewController.h"
#import "XXIneractiveTransition.h"

@interface BNavViewController ()
@property (nonatomic, strong) XXIneractiveTransition *percentDrivenInteractiveTransition;
@property (nonatomic, assign) CGFloat percent;
@end

@implementation BNavViewController

-(id)initWithCoder:(NSCoder *)aDecoder{
    if (self = [super initWithCoder:aDecoder]) {
        [self initModalTransiton];
    }
    return self;
}

-(id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil{
    if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) {
        [self initModalTransiton];
    }
    return self;
}

- (void)initModalTransiton {
    self.modalPresentationStyle = UIModalPresentationCustom;
    self.transitioningDelegate  = self.percentDrivenInteractiveTransition;
}

- (void)viewDidLoad {
    [super viewDidLoad];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
}

- (IBAction)dismissClick:(id)sender {
    [self dismissViewControllerAnimated:YES completion:nil];
}

- (XXIneractiveTransition *)percentDrivenInteractiveTransition {
    if (_percentDrivenInteractiveTransition == nil) {
        _percentDrivenInteractiveTransition = [[XXIneractiveTransition alloc] init];
        [_percentDrivenInteractiveTransition addPanGestureForViewController:self];
    }
    return _percentDrivenInteractiveTransition;
}

@end
